namespace SmallBasicFun.Quizes
{
	public class SquareQuiz : IQuiz
	{
		public Question Question1Turn
		{
			get { return Quiz.questions[0]; }
		}

		public Question Question2Move
		{
			get { return Quiz.questions[1]; }
		}

		public Question Question3Color
		{
			get { return Quiz.questions[2]; }
		}

		public Question Question4Width
		{
			get { return Quiz.questions[3]; }
		}

		public void StartTest()
		{
			GradeResults();
			ProgramWindow.SetBackgroundColor(Colors.Black);
			Tortoise.SetOrientation(60,80,90);
			Question3Color.Run();
			Question4Width.Run();
			Tortoise.SetSpeed(10);
			for (int i = 0; i < 5; i++)
			{
				Question2Move.Run();
				Question1Turn.Run();
				Question1Turn.Run();
			}
			Quiz.DisplayScores(4, 200);
		}


		private void GradeResults()
		{
			Grade1Turn();
			Grade2Move();
			Grade3Color();
			Grade4Width();
		}

		private void Grade4Width()
		{
			Question4Width.Run();
			Question4Width.Result = Tortoise.GetPenWidth() == 5;
		}

		private void Grade3Color()
		{
			Question3Color.Run();
			Question3Color.Result = Colors.CompareColors(Tortoise.GetPenColor(), Colors.Yellow);
		}

		private void Grade2Move()
		{
			TurtleGrader.GradeMoveTurtle(Question2Move, 110);
		}

		private void Grade1Turn()
		{
			TurtleGrader.GradeTurnTurtle(Question1Turn, 360/5);
		}
	}
}